<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\Fund;

/* @var $this yii\web\View */
/* @var $searchModel common\models\FundSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Funds';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="fund-index" style="overflow:auto;">

<!--     <h1><?= Html::encode($this->title) ?></h1> -->
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <!-- <p>
        <?= Html::a('创建资金', ['create'], ['class' => 'btn btn-success']) ?>
    </p> -->
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'tableOptions' => ['class' => 'table table-striped table-bordered','style'=>'width:auto;max-width:none;'],
        'options' => ['class' => 'grid-view','style'=>'overflow:auto'],
        'columns' => [
            //['class' => 'yii\grid\SerialColumn'],

            'id',
            [
                'attribute' => 'user_username',
                'value' => 'user.username',
                //'filter'=> 'user.phone',
            ],//'user.username',
            'relation_id1',
            'relation_id2',
            [
                'attribute' => 'fund_type',
                'value' => function ($model, $key, $index, $column) {
                    return Fund::itemAlias("fund_type", $model->fund_type);
                },
                'filter'=>Fund::itemAlias("fund_type"),
            ],
             'deal_money',
             'available_money',
             //'remark',
             'create_time',

        ['class' => 'yii\grid\ActionColumn', 'template' => '{view}',],
        ],
    ]); ?>
</div>
